package certification.sections.session11.cap14;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Controller extends HttpServlet {
	
	private static final long serialVersionUID = 6287395232005010319L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		execute(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		execute(req, resp);
	}
	
	public void execute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String action = req.getParameter("action");
		
		/*if("to".equals(action)) {*/
			TransferObject to = BusinnesDelegate.getInstance().getTransferObject();
			req.getSession().setAttribute("to", to);
			RequestDispatcher rd = req.getRequestDispatcher("/sucesso.jsp");
			rd.forward(req, resp);
		/*}*/
	}

}
